#ifndef frm_control_TPanelWin_H
#define frm_control_TPanelWin_H

#include "frm_control_TPanel.h"
namespace frm { namespace control {

///////////////////////////////////////////////////////////////////////////////
//BeginDeferWindowPos

struct TPanelWin : public control::TPanel , public grf::TWindow
{
  TPanelWin(control::TWindow &Window);
  //
  virtual void AddChildFirst (TComponent *Add,bool EnDelete = true)                  { Except("AddChildFirst");}
  virtual void AddChildLast  (TComponent *Add,bool EnDelete = true)                  { Except("AddChildLast");}
  virtual void AddChildBefore(TComponent *Add,TComponent *Curr,bool EnDelete = true) { Except("AddChildBefore");}
  virtual void AddChildAfter (TComponent *Add,TComponent *Curr,bool EnDelete = true) { Except("AddChildAfter");}
  //
  virtual void TPanelWin_SetWindowRect(grf::TRect Rect) {}

protected:
  virtual void TComponent_Paint(TPaint &Paint,int NPaintStack);
  virtual void TComponent_HideWindow(grf::TWindowArray &Array) { if (!IsVisibleInParents()) { Array.Add(this,false);} }
  virtual void TWindow_Paint(grf::TPaint &Paint);
  virtual void TWindow_Mouse(grf::TMouse &Mouse);
  
  static LRESULT CALLBACK ChildWndProc( HWND _hwnd, UINT _msg, WPARAM _wParam, LPARAM _lParam);
  void SetChildControl(HWND _hwnd);

private:
  TPanel *getParent()     { return dynamic_cast<TPanel*>(GetParent()); }
  TPanel &getChild(int N) { return dynamic_cast<TPanel&>(GetChild(N)); }
  svl_Except;
  HWND ChildWindow;
  static WNDPROC oldChildProc;
};

///////////////////////////////////////////////////////////////////////////////
}}

#endif
